<html>

<head>
    <base href='/'>
    <title>箭头函数里的this</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript">
    function foo1() {
    	console.log('foo1 this:');
    	console.log(this);
        setTimeout(() => {
        	console.log("箭头函数里的this:");
        	console.log(this);
            console.log('箭头函数里的id:', this.id);
        }, 0);
    }

    var id = 21;

    foo1.call({
        id: 42
    });
    
    function foo2() {
    	console.log('foo2 this:');
    	console.log(this);
        setTimeout(function() {
        	console.log("普通函数里的this:");
        	console.log(this);
            console.log('普通函数里的id:', this.id);
        }, 0);
    }

    var id = 21;

    foo2.call({
        id: 42
    });
    </script>
    </head>
    <body></body>
    </html>
